import {
	_ as u,
	o as i,
	c as d,
	F as f,
	r as k,
	a as s,
	w as h,
	v as g,
	n as p,
	t as y,
	b as C,
	p as $,
	d as x,
	e as c,
	f as A,
	g as r,
	h as B
} from "./index-Cs3YldeA.js";
const T = {
		name: "todolist",
		props: {
			todolist: {
				type: Array,
				required: !0,
				default: []
			}
		}
	},
	w = {
		class: "list-group"
	},
	V = {
		class: "form-check"
	},
	I = ["id", "onUpdate:modelValue"],
	S = ["for"],
	U = {
		key: 0,
		class: "badge badge-primary badge-pill"
	},
	N = {
		key: 1,
		class: "badge badge-warning badge-pill"
	};

function D(t, o, l, _, a, n) {
	return i(), d("ul", w, [(i(!0), d(f, null, k(l.todolist, e => (i(), d("li", {
		class: "list-group-item d-flex justify-content-between align-items-center",
		key: e.id
	}, [s("div", V, [h(s("input", {
		class: "form-check-input",
		type: "checkbox",
		value: "",
		id: e.id,
		"onUpdate:modelValue": m => e.isCompleted = m
	}, null, 8, I), [
		[g, e.isCompleted]
	]), s("label", {
		class: p(["form-check-label", e.isCompleted ? "delete" : ""]),
		for: e.id
	}, y(e.task), 11, S)]), e.isCompleted ? (i(), d("span", U, "已完成")) : (i(), d(
		"span", N, "未完成"))]))), 128))])
}
const F = u(T, [
		["render", D],
		["__scopeId", "data-v-cd231053"]
	]),
	M = {
		name: "todoButton",
		data() {
			return {
				active: 0
			}
		},
		emits: ["changeActive"],
		methods: {
			changeActive(t) {
				this.active = t, this.$emit("changeActive", t)
			}
		}
	},
	j = {
		class: "btn-group",
		role: "group",
		"aria-label": "Basic example"
	};

function q(t, o, l, _, a, n) {
	return i(), d("div", j, [s("button", {
		type: "button",
		class: p(["btn", a.active === 0 ? "btn-primary" : "btn-secondary"]),
		onClick: o[0] || (o[0] = e => n.changeActive(0))
	}, "全部", 2), s("button", {
		type: "button",
		class: p(["btn", a.active === 1 ? "btn-primary" : "btn-secondary"]),
		onClick: o[1] || (o[1] = e => n.changeActive(1))
	}, "已完成", 2), s("button", {
		type: "button",
		class: p(["btn", a.active === 2 ? "btn-primary" : "btn-secondary"]),
		onClick: o[2] || (o[2] = e => n.changeActive(2))
	}, "未完成", 2)])
}
const z = u(M, [
		["render", q],
		["__scopeId", "data-v-687731f9"]
	]),
	E = {
		data() {
			return {
				taskname: ""
			}
		},
		emits: ["addTask"],
		methods: {
			onsubmit() {
				this.$emit("addTask", this.taskname), this.taskname = ""
			}
		}
	},
	H = t => ($("data-v-264be88d"), t = t(), x(), t),
	L = {
		class: "input-group mb-3"
	},
	G = H(() => s("div", {
		class: "input-group-prepend"
	}, [s("span", {
		class: "input-group-text",
		id: "basic-addon1"
	}, "新建任务")], -1));

function J(t, o, l, _, a, n) {
	return i(), d("div", L, [G, h(s("input", {
		type: "text",
		class: "form-control",
		placeholder: "请输入任务",
		"aria-label": "Username",
		"aria-describedby": "basic-addon1",
		"onUpdate:modelValue": o[0] || (o[0] = e => a.taskname = e)
	}, null, 512), [
		[C, a.taskname]
	]), s("button", {
		class: "btn-primary",
		onClick: o[1] || (o[1] = (...e) => n.onsubmit && n.onsubmit(...e))
	}, "添加")])
}
const K = u(E, [
		["render", J],
		["__scopeId", "data-v-264be88d"]
	]),
	O = {
		data() {
			return {
				todolist: [{
					id: 1,
					task: "运动",
					isCompleted: !0,
                
				}, {
					id: 2,
					task: "学习",
					isCompleted: !1
				}, {
					id: 3,
					task: "打游戏",
					isCompleted: !1
				}],
				active: 0
			}
		},
		computed: {
			todolist() {
				return this.active === 0 ? this.todolist : this.active === 1 ? this.todolist.filter(t => t
					.isCompleted) : this.todolist.filter(t => !t.isCompleted)
			}
		},
		methods: {
			changeActive(t) {
				this.active = t, console.log(this.active)
			},
			addTask(t) {
				this.todolist.push({
					id: this.todolist.length + 1,
					task: t,
					isCompleted: !1
				})
			}
		},
		components: {
			todolist: F,
			todoButton: z,
			todoinput: K
		}
	},
	P = {
		id: "app"
	},
	Q = s("h1", null, "待办事项", -1),
	R = s("span", null, [s("a", {
		href: "https://gitee.com/wang-shengqua/projects"
	}, "仓库地址")], -1);

function W(t, o, l, _, a, n) {
	const e = r("todoinput"),
		m = r("todolist"),
		b = r("todoButton"),
		v = r("router-link");
	return i(), d("div", null, [s("div", P, [Q, c(e, {
		onAddTask: n.addTask
	}, null, 8, ["onAddTask"]), c(m, {
		todolist: n.todolist
	}, null, 8, ["todolist"]), c(b, {
		onChangeActive: n.changeActive
	}, null, 8, ["onChangeActive"])]), s("div", null, [R, s("span", null, [c(v, {
		to: "/about",
		class: "about-link"
	}, {
		default: A(() => [B ("个人简介")]),
		_: 1
	})])])])
}
const Y = u(O, [
	["render", W]
]);
export {
	Y as
	default
};